<template>
  <div class="app-container">
    <!-- 高级查询 -->
    <el-form v-show="searchVisible" ref="queryForm" :model="queryParams" :inline="true">
      <el-form-item label=":">
        <el-input v-model="queryParams.routeCode" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.routeName" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.routeForShot" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.startLocation" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.endLocation" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.noteText" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.lightMilometer" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.weightMilometer" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.milometer" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.routeFee" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.routeHour" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.retrunLocation" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.preNodeQty" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.lowNodeQty" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.isActived" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.version" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.leadTm" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.distributorSite" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.isControled" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="终点货场地址:">
        <el-input v-model="queryParams.dropOffAdd" size="small" placeholder="请输入终点货场地址" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="起点货场地址:">
        <el-input v-model="queryParams.pickUpAdd" size="small" placeholder="请输入起点货场地址" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.site" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.estDeliveryDays" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.departDistributorSite" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.carrierNo" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.routeCustFee" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.carrierName" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.wtRate" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.phRate" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.minimCharge" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.avaLocation" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-date-picker v-model="queryParams.estArrDate" type="date" value-format="yyyy-MM-dd" size="small" placeholder="选择" clearable />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.vehicleLength" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="创建时间:">
        <el-date-picker v-model="queryParams.createDate" type="date" value-format="yyyy-MM-dd" size="small" placeholder="选择创建时间" clearable />
      </el-form-item>
      <el-form-item label="更新时间:">
        <el-date-picker v-model="queryParams.updateDate" type="date" value-format="yyyy-MM-dd" size="small" placeholder="选择更新时间" clearable />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.averagePrice" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.maxPrice" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.lowestPrice" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.newestPrice" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.priceCt" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label=":">
        <el-input v-model="queryParams.vehicleModel" size="small" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button v-hasPermission="['transitRoute:tFoTransitRoute:insert']" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button v-hasPermission="['transitRoute:tFoTransitRoute:update']" type="success" icon="el-icon-edit" size="mini" :disabled="isSingle" @click="handleEdit">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button v-hasPermission="['transitRoute:tFoTransitRoute:delete']" type="danger" icon="el-icon-delete" size="mini" :disabled="isMultiple" @click="handleRemove">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button v-hasPermission="['transitRoute:tFoTransitRoute:export']" type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
      </el-col>
      <right-toolbar :show-search.sync="searchVisible" @queryTable="handleQuery" />
    </el-row>

    <!-- 数据列表 -->
    <el-table v-loading="loading" :data="page.records" highlight-current-row @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="" align="center" prop="routeCode" />
      <el-table-column label="" align="center" prop="routeName" />
      <el-table-column label="" align="center" prop="routeForShot" />
      <el-table-column label="" align="center" prop="startLocation" />
      <el-table-column label="" align="center" prop="endLocation" />
      <el-table-column label="" align="center" prop="noteText" />
      <el-table-column label="" align="center" prop="lightMilometer" />
      <el-table-column label="" align="center" prop="weightMilometer" />
      <el-table-column label="" align="center" prop="milometer" />
      <el-table-column label="" align="center" prop="routeFee" />
      <el-table-column label="" align="center" prop="routeType" />
      <el-table-column label="" align="center" prop="routeHour" />
      <el-table-column label="" align="center" prop="retrunLocation" />
      <el-table-column label="" align="center" prop="preNodeQty" />
      <el-table-column label="" align="center" prop="lowNodeQty" />
      <el-table-column label="" align="center" prop="isActived" />
      <el-table-column label="" align="center" prop="version" />
      <el-table-column label="" align="center" prop="leadTm" />
      <el-table-column label="" align="center" prop="distributorSite" />
      <el-table-column label="" align="center" prop="isControled" />
      <el-table-column label="终点货场地址" align="center" prop="dropOffAdd" />
      <el-table-column label="起点货场地址" align="center" prop="pickUpAdd" />
      <el-table-column label="" align="center" prop="site" />
      <el-table-column label="" align="center" prop="estDeliveryDays" />
      <el-table-column label="" align="center" prop="departDistributorSite" />
      <el-table-column label="" align="center" prop="carrierNo" />
      <el-table-column label="" align="center" prop="routeCustFee" />
      <el-table-column label="" align="center" prop="carrierName" />
      <el-table-column label="" align="center" prop="wtRate" />
      <el-table-column label="" align="center" prop="phRate" />
      <el-table-column label="" align="center" prop="minimCharge" />
      <el-table-column label="" align="center" prop="avaLocation" />
      <el-table-column label="" align="center" prop="estArrDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.estArrDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="" align="center" prop="vehicleLength" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="创建时间" align="center" prop="createDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新时间" align="center" prop="updateDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="" align="center" prop="averagePrice" />
      <el-table-column label="" align="center" prop="maxPrice" />
      <el-table-column label="" align="center" prop="lowestPrice" />
      <el-table-column label="" align="center" prop="newestPrice" />
      <el-table-column label="" align="center" prop="priceCt" />
      <el-table-column label="" align="center" prop="ftlRequestVehicleType" />
      <el-table-column label="" align="center" prop="vehicleModel" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button v-hasPermission="['transitRoute:tFoTransitRoute:update']" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">修改</el-button>
          <el-button v-hasPermission="['transitRoute:tFoTransitRoute:delete']" size="mini" type="text" icon="el-icon-delete" @click="handleRemove(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <pagination v-show="page.total>0" :total="page.total" :page.sync="page.current" :limit.sync="page.pageSize" @pagination="handleQuery" />

    <!-- 添加/修改对话框 -->
    <el-dialog :title="tFoTransitRouteFormDialog.title" :visible.sync="tFoTransitRouteFormDialog.visible" :close-on-click-modal="false" :before-close="resetTFoTransitRouteFormDialog" width="500px" append-to-body>
      <el-form ref="tFoTransitRouteForm" :model="tFoTransitRouteFormData" :rules="tFoTransitRouteFormRules" label-width="80px">
        <el-form-item label="" prop="routeCode">
          <el-input v-model="tFoTransitRouteFormData.routeCode" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="routeName">
          <el-input v-model="tFoTransitRouteFormData.routeName" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="routeForShot">
          <el-input v-model="tFoTransitRouteFormData.routeForShot" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="startLocation">
          <el-input v-model="tFoTransitRouteFormData.startLocation" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="endLocation">
          <el-input v-model="tFoTransitRouteFormData.endLocation" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="noteText">
          <el-input v-model="tFoTransitRouteFormData.noteText" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="lightMilometer">
          <el-input v-model="tFoTransitRouteFormData.lightMilometer" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="weightMilometer">
          <el-input v-model="tFoTransitRouteFormData.weightMilometer" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="milometer">
          <el-input v-model="tFoTransitRouteFormData.milometer" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="routeFee">
          <el-input v-model="tFoTransitRouteFormData.routeFee" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="routeHour">
          <el-input v-model="tFoTransitRouteFormData.routeHour" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="retrunLocation">
          <el-input v-model="tFoTransitRouteFormData.retrunLocation" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="preNodeQty">
          <el-input v-model="tFoTransitRouteFormData.preNodeQty" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="lowNodeQty">
          <el-input v-model="tFoTransitRouteFormData.lowNodeQty" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="isActived">
          <el-input v-model="tFoTransitRouteFormData.isActived" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="version">
          <el-input v-model="tFoTransitRouteFormData.version" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="leadTm">
          <el-input v-model="tFoTransitRouteFormData.leadTm" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="distributorSite">
          <el-input v-model="tFoTransitRouteFormData.distributorSite" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="isControled">
          <el-input v-model="tFoTransitRouteFormData.isControled" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="终点货场地址" prop="dropOffAdd">
          <el-input v-model="tFoTransitRouteFormData.dropOffAdd" placeholder="请输入终点货场地址" />
        </el-form-item>
        <el-form-item label="起点货场地址" prop="pickUpAdd">
          <el-input v-model="tFoTransitRouteFormData.pickUpAdd" placeholder="请输入起点货场地址" />
        </el-form-item>
        <el-form-item label="" prop="site">
          <el-input v-model="tFoTransitRouteFormData.site" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="estDeliveryDays">
          <el-input v-model="tFoTransitRouteFormData.estDeliveryDays" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="departDistributorSite">
          <el-input v-model="tFoTransitRouteFormData.departDistributorSite" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="carrierNo">
          <el-input v-model="tFoTransitRouteFormData.carrierNo" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="routeCustFee">
          <el-input v-model="tFoTransitRouteFormData.routeCustFee" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="carrierName">
          <el-input v-model="tFoTransitRouteFormData.carrierName" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="wtRate">
          <el-input v-model="tFoTransitRouteFormData.wtRate" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="phRate">
          <el-input v-model="tFoTransitRouteFormData.phRate" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="minimCharge">
          <el-input v-model="tFoTransitRouteFormData.minimCharge" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="avaLocation">
          <el-input v-model="tFoTransitRouteFormData.avaLocation" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="estArrDate">
          <el-date-picker v-model="tFoTransitRouteFormData.estArrDate" type="date" value-format="yyyy-MM-dd" size="small" style="width: 100%" placeholder="选择" clearable />
        </el-form-item>
        <el-form-item label="" prop="vehicleLength">
          <el-input v-model="tFoTransitRouteFormData.vehicleLength" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="tFoTransitRouteFormData.remark" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createDate">
          <el-date-picker v-model="tFoTransitRouteFormData.createDate" type="date" value-format="yyyy-MM-dd" size="small" style="width: 100%" placeholder="选择创建时间" clearable />
        </el-form-item>
        <el-form-item label="更新时间" prop="updateDate">
          <el-date-picker v-model="tFoTransitRouteFormData.updateDate" type="date" value-format="yyyy-MM-dd" size="small" style="width: 100%" placeholder="选择更新时间" clearable />
        </el-form-item>
        <el-form-item label="" prop="averagePrice">
          <el-input v-model="tFoTransitRouteFormData.averagePrice" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="maxPrice">
          <el-input v-model="tFoTransitRouteFormData.maxPrice" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="lowestPrice">
          <el-input v-model="tFoTransitRouteFormData.lowestPrice" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="newestPrice">
          <el-input v-model="tFoTransitRouteFormData.newestPrice" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="priceCt">
          <el-input v-model="tFoTransitRouteFormData.priceCt" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="" prop="vehicleModel">
          <el-input v-model="tFoTransitRouteFormData.vehicleModel" placeholder="请输入" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirmTFoTransitRouteFormDialog">确 定</el-button>
        <el-button @click="resetTFoTransitRouteFormDialog">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import TFoTransitRouteApi from '@/api/transitRoute/TFoTransitRouteApi'

const defaultTFoTransitRouteFormData = {
  routeCode: null,  routeName: null,  routeForShot: null,  startLocation: null,  endLocation: null,  noteText: null,  lightMilometer: null,  weightMilometer: null,  milometer: null,  routeFee: null,  routeType: null,  routeHour: null,  retrunLocation: null,  preNodeQty: null,  lowNodeQty: null,  isActived: null,  version: null,  leadTm: null,  distributorSite: null,  isControled: null,  dropOffAdd: null,  pickUpAdd: null,  site: null,  estDeliveryDays: null,  departDistributorSite: null,  carrierNo: null,  routeCustFee: null,  carrierName: null,  wtRate: null,  phRate: null,  minimCharge: null,  avaLocation: null,  estArrDate: null,  vehicleLength: null,  createDate: null,  updateDate: null,  averagePrice: null,  maxPrice: null,  lowestPrice: null,  newestPrice: null,  priceCt: null,  ftlRequestVehicleType: null,  vehicleModel: null}
export default {
  name: 'TFoTransitRouteList',
  data() {
    return {
      options: {
        sysYnTypeOptions: this.$constant.sysYnTypeOptions
      },
      queryParams: {
        routeCode: null,
        routeName: null,
        routeForShot: null,
        startLocation: null,
        endLocation: null,
        noteText: null,
        lightMilometer: null,
        weightMilometer: null,
        milometer: null,
        routeFee: null,
        routeType: null,
        routeHour: null,
        retrunLocation: null,
        preNodeQty: null,
        lowNodeQty: null,
        isActived: null,
        version: null,
        leadTm: null,
        distributorSite: null,
        isControled: null,
        dropOffAdd: null,
        pickUpAdd: null,
        site: null,
        estDeliveryDays: null,
        departDistributorSite: null,
        carrierNo: null,
        routeCustFee: null,
        carrierName: null,
        wtRate: null,
        phRate: null,
        minimCharge: null,
        avaLocation: null,
        estArrDate: null,
        vehicleLength: null,
        createDate: null,
        updateDate: null,
        averagePrice: null,
        maxPrice: null,
        lowestPrice: null,
        newestPrice: null,
        priceCt: null,
        ftlRequestVehicleType: null,
        vehicleModel: null,
        isValid: this.$constant.Y
      },
      page: {
        current: 1,
        pageSize: 10,
        total: 0,
        records: []
      },
      tFoTransitRouteFormDialog: {
        title: '',
        visible: false
      },
      tFoTransitRouteFormData: Object.assign({}, defaultTFoTransitRouteFormData),
      tFoTransitRouteFormRules: {
        createDate: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
        updateDate: [{ required: true, message: '更新时间不能为空', trigger: 'blur' }],
      },
      loading: true,
      searchVisible: true,
      multipleSelection: [],
      isSingle: true,
      isMultiple: true
    }
  },
  created() {
    this.handleQuery()
    this.loadOptions()
  },
  methods: {
    loadOptions() {
    },
    handleAdd() {
      this.openTFoTransitRouteFormDialog()
    },
    handleRemove(row) {
      const ids = row.id || this.multipleSelection.map(item => item.id)
      this.$confirm('是否确认删除数据?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        return TFoTransitRouteApi.remove(ids)
      }).then(() => {
        this.handleQuery()
        this.$message.success('删除成功')
      })
    },
    handleEdit(row) {
      const id = row.id || this.multipleSelection.map(item => item.id)[0]
      this.openTFoTransitRouteFormDialog(id)
    },
    handleQuery() {
      this.loading = true
      TFoTransitRouteApi.page(this.queryParams, this.page).then(response => {
        this.page.records = response.data.records
        this.page.total = response.data.total
        this.loading = false
      }, () => {
        this.loading = false
      })
    },
    handleExport() {
      this.$confirm('是否确认导出数据?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        return TFoTransitRouteApi.exportData(this.queryParams)
      }).then(response => {
        this.$common.download(response.msg)
      })
    },
    openTFoTransitRouteFormDialog(id) {
      this.tFoTransitRouteFormDialog.visible = true
      if (id) {
        this.tFoTransitRouteFormDialog.title = '运输线路-修改'
        TFoTransitRouteApi.get(id).then(response => {
          this.tFoTransitRouteFormData = {
            ...this.tFoTransitRouteFormData,
            ...response.data
          }
        })
      } else {
        this.tFoTransitRouteFormDialog.title = '运输线路-添加'
      }
    },
    confirmTFoTransitRouteFormDialog() {
      this.$refs['tFoTransitRouteForm'].validate(valid => {
        if (valid) {
          if (this.tFoTransitRouteFormData.id) {
            TFoTransitRouteApi.edit(this.tFoTransitRouteFormData).then(response => {
              this.$message.success('修改成功')
              this.resetTFoTransitRouteFormDialog()
              this.handleQuery()
            })
          } else {
            TFoTransitRouteApi.add(this.tFoTransitRouteFormData).then(response => {
              this.$message.success('添加成功')
              this.resetTFoTransitRouteFormDialog()
              this.handleQuery()
            })
          }
        }
      })
    },
    resetTFoTransitRouteFormDialog() {
      this.tFoTransitRouteFormDialog = {
        title: '',
        visible: false
      }
      this.tFoTransitRouteFormData = Object.assign({}, defaultTFoTransitRouteFormData)
      this.resetForm('tFoTransitRouteForm')
    },
    handleSelectionChange(selection) {
      this.multipleSelection = selection
      this.isSingle = selection.length !== 1
      this.isMultiple = !selection.length
    },
    resetQuery() {
      this.page.current = 1
      this.resetForm('queryForm')
      this.handleQuery()
    }
  }
}
</script>
